﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Crude.Core
{
    public static class FrameworkUtility
    {
        public static HashSet<string> GetFrameworkAssemblies()
        {
            string[] files =
             Directory.GetFiles(@"C:\Windows\Microsoft.NET\Framework", "*.dll", SearchOption.AllDirectories);

            HashSet<string> assemblies = new HashSet<string>();

            foreach (string fileName in files)
            {
                FileInfo fileInfo = new FileInfo(fileName);

                string assemblyName = fileInfo.Name.Remove(fileInfo.Name.Length - fileInfo.Extension.Length);

                assemblies.Add(assemblyName.ToLower());
            }

            return assemblies;
        }
    }
}
